﻿using LSL.SqlClient;
using System;

namespace Liu_Project.Utils
{
    public class LogFunction
    {
        public static void WriteLog(string funName, Exception ex, params object[] agrs)
        {
            string err = "";
            for (int i = 0; i < agrs.Length; i++)
            {
                err += "第" + i + "个参数:" + Newtonsoft.Json.JsonConvert.SerializeObject(agrs[i]) + "；\r\n ";
            }

            Log.Instance.WriteLog(funName, "Begin \r\n " + ex + " \r\n " + err + " \r\n End");
        }

        public static void WriteLog(string funName, params object[] agrs)
        {
            string err = "";
            for (int i = 0; i < agrs.Length; i++)
            {
                err += "第" + i + "个参数:" + Newtonsoft.Json.JsonConvert.SerializeObject(agrs[i]) + "；\r\n ";
            }

            Log.Instance.WriteLog(funName, "Begin \r\n " + err + " \r\n End");
        }
    }
}
